// DlgCircleColumn.cpp : implementation file
//

#include "stdafx.h"
#include "pdarx.h"
#include "DlgCircleColumn.h"
#include "UeItem.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

static short width_list[] =
{	
	200, 
	250, 
	300,
	350,
	400,
	450,
	500,
	550,
	600,
	650,
	700,
	750,
	800,
	850,
	900,
	950,
	1000,
	1050,
	1100,
	1150,
	1200,
	1250,
	1300,
	1350,
	1400,
	1450,
	1500,
	1550,
	1600,
	1650,
	1700,
	1750,
	1800,
	1850,
	1900,
	1950,
	2000,
	2100,
	2200,
	2300,
	2400,
	2500,
	2600,
	2700,
	2800,
	2900,
	3000
};
/////////////////////////////////////////////////////////////////////////////
// CDlgCircleColumn dialog


CDlgCircleColumn::CDlgCircleColumn(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgCircleColumn::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgCircleColumn)
	m_dRadius = 0.0;
	m_dOffsetX = 0.0;
	m_dOffsetY = 0.0;
	//}}AFX_DATA_INIT
	::AfxSetResourceHandle(g_ARXInstance);
}


void CDlgCircleColumn::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgCircleColumn)
	DDX_Control(pDX, IDC_LIST_RADIUS, m_lstRadius);
	DDX_Text(pDX, IDC_EDIT_COLUMN_RADIUS, m_dRadius);
	DDX_Text(pDX, IDC_EDIT_COLUMN_OFFSET_X, m_dOffsetX);
	DDX_Text(pDX, IDC_EDIT_COLUMN_OFFSET_Y, m_dOffsetY);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgCircleColumn, CDialog)
	//{{AFX_MSG_MAP(CDlgCircleColumn)
	ON_LBN_SELCHANGE(IDC_LIST_RADIUS, OnSelchangeListRadius)
	ON_WM_CREATE()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgCircleColumn message handlers

CUeList CDlgCircleColumn::GetColumnValue()
{
	CUeList rtList;

	rtList.AddTail(CUeItem(m_dRadius));
	rtList.AddTail(CUeItem(m_dOffsetX));
	rtList.AddTail(CUeItem(m_dOffsetY));
	
	return rtList;
}

void CDlgCircleColumn::OnSelchangeListRadius() 
{
	// TODO: Add your control notification handler code here
	UpdateData();
	int nSel = m_lstRadius.GetCurSel();
	m_dRadius = width_list[nSel];
	UpdateData(FALSE);
}

BOOL CDlgCircleColumn::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CString strTmp;
	for (int i = 0; i < sizeof(width_list) / sizeof(short); i++)
	{
		strTmp.Format(_T("%d"), width_list[i]);
		m_lstRadius.AddString(strTmp);
	}

	m_dRadius = width_list[0];

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

int CDlgCircleColumn::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CDialog::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	::AfxSetResourceHandle(g_CADInstance);
	
	return 0;
}
